#ifndef __GSPRITE_H__
#define __GSPRITE_H__
#include "windows.h"
#include <d3d9.h>
#include <d3dx9.h>

class CSprites
{
public:
	static LPD3DXSPRITE _spriteHandler;
	LPDIRECT3DTEXTURE9  _image;        //source image
	int                 _width;        //chieu rog anh
	int                 _height;       //chieu cao
	int                 _index;        //vi tri index
	int					_row;          //so frame tren 1 hang
	bool				_loop;         // co lap ko
	bool				_enable;       //co cho di chuyen ko
	bool				_clear;        //co lam mo hay o
	int					_alpha;        //hieu ung nhap nhay
	int					_left;         //vi tri tren ban do
	int					_top;
	int					_count;
	DWORD				_rootTime;     //thoi gian ban dau
	DWORD				_oldTime;       //thoi gian sau 1 frame
	int					_totalExistTime;//Thoi gian ton tai
	int					_interval;//kiem soat chuyen dong khac

	//------------Method-------------
	//constructor
	CSprites(LPDIRECT3DTEXTURE9 image,bool loop,int index,int count,int row,int width,int height,
		int left,int top,int totalExistTime,int interval);
	CSprites(LPCSTR filePath, int width, int height, int count,int row);
	~CSprites(void);

	static LPDIRECT3DTEXTURE9 LoadTexture(LPCSTR filePath,D3DCOLOR transcolor); 
	void Draw(int leftRect, int StyleDraw,bool isClear); 
	void Render(float,float,int);
};
#endif